package pbbltobpel.model.steps;

import org.w3c.dom.Document;
import org.w3c.dom.Element;

import pbbltobpel.model.PartnerLinkMyRole;
import pbbltobpel.model.Variable;

public class ReceiveStep extends Step {
	private PartnerLinkMyRole link;
	private String operation;
	private Variable variable;
	private boolean createInstance;
	
	public boolean isCreateInstance() {
		return createInstance;
	}
	public void setCreateInstance(boolean createInstance) {
		this.createInstance = createInstance;
	}
	public String getOperation() {
		return operation;
	}
	public void setOperation(String operation) {
		this.operation = operation;
	}
	public PartnerLinkMyRole getLink() {
		return link;
	}
	public void setLink(PartnerLinkMyRole link) {
		this.link = link;
	}
	public Variable getVariable() {
		return variable;
	}
	public void setVariable(Variable variable) {
		this.variable = variable;
	}
	@Override
	public Element getXmlElement(Document doc) {
		Element element = doc.createElement("bpel:receive");
		element.setAttribute("name", getName());
		element.setAttribute("partnerLink", link.getName());
		element.setAttribute("portType", link.getPartnerLinkType());
		element.setAttribute("operation", operation);
		element.setAttribute("variable", variable.getName());
		element.setAttribute("createInstance", createInstance ? "yes" : "no");
		return element;
	}
	
}
